<?php

namespace catchAdmin\pc\controller;

use catchAdmin\pc\model\SysVocation as SysVocationModel;
use catchAdmin\pc\request\sysVocation\AuditRequest;
use catchAdmin\pc\request\sysVocation\SaveRequest;
use catcher\base\CatchController;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use think\Response;

class SysVocation extends CatchController
{

    protected $sysVocationModel;


    /**
     *
     * @time 2025/08/01 15:20
     * @param SysVocationModel $sysVocationModel
     * @return mixed
     */
    public function __construct(SysVocationModel $sysVocationModel)
    {
        $this->sysVocationModel = $sysVocationModel;
    }


    /**
     *
     * @time 2025/08/01 15:20
     * @return Response
     */
    public function index(Request $request): Response
    {
        return CatchResponse::successPcList($this->sysVocationModel->indexData($request->param()));
    }


    public function indexByPid(Request $request): Response
    {
        return CatchResponse::successPcList($this->sysVocationModel->indexByPid($request->param()));
    }


    /**
     * 一二级分类
     */
    public function index12(Request $request): Response
    {
        return CatchResponse::success($this->sysVocationModel->index12($request->param()));
    }


    /**
     * 一二级分类
     */
    public function index3(Request $request): Response
    {
        return CatchResponse::success($this->sysVocationModel->index3($request->param()));
    }


    /**
     *
     * @time 2025/08/01 15:20
     * @param Request $request
     * @return Response
     */
    public function save(SaveRequest $request): Response
    {
        return CatchResponse::success($this->sysVocationModel->saveData($request->post()));
    }


    /**
     * 审核
     */
    public function audit(AuditRequest $request): Response
    {
        return CatchResponse::success($this->sysVocationModel->audit($request->post()));
    }


    /**
     *
     * @time 2025/08/01 15:20
     * @param $id
     * @return Response
     */
    public function read($id): Response
    {
        return CatchResponse::success($this->sysVocationModel->findBy($id));
    }


    /**
     *
     * @time 2025/08/01 15:20
     * @param $id
     * @param Request $request
     * @return Response
     */
    public function update($id, Request $request): Response
    {
        return CatchResponse::success($this->sysVocationModel->updateBy($id, $request->post()));
    }


    /**
     *
     * @time 2025/08/01 15:20
     * @param $id
     * @return Response
     */
    public function del(Request $request): Response
    {
        return CatchResponse::success($this->sysVocationModel->deleteData($request->param()));
    }
}
